<?php

/** 
* 
* 
* by:南宁火蝶科技有限公司 http:///www.HdsysCms.com
* 声明:本系统禁止用二次开发、侵犯HdsysCms著作和除去HdsysCms进行售卖,如发现将追究一切权利,模版制作属于自己所得可以通过本系统对外开发模版获取收益!
* 
* 2019年第一版本发布 - 到2023.9.1开源使用! 
* php混淆工具:phpencry.wbox.top
* 
* 注意防骗:@HdsysCms 官方没授权任何个人机构合作,唯一收款抬头:《南宁火蝶科技有限公司》和官网显示客服唯一渠道客服,其它渠道以HdsysCms名义行为均骗子!
*
*/
	

defined('HDSYS_SET') or die("" . 'Not,This File Not Can in Ie Open' . "" . 'xxxxx');
function new_is_writeable($param_file)
{
if (is_dir($param_file)) {
$param_dir=$param_file;
if ($param_fp=@fopen("$param_dir/is_writeable.txt", 'w')) {
@fclose($param_fp);
@unlink("$param_dir/is_writeable.txt");
$param_writeable=1;
} else {
$param_writeable=0;
}
} else {
if ($param_fp=@fopen($param_file, 'a+')) {
@fclose($param_fp);
$param_writeable=1;
} else {
$param_writeable=0;
}
@unlink($param_file);
}
return $param_writeable;
}
function open_list_dir_t($param_pach)
{
$param_while_id=0;
$param_array=array();
$param_handle=opendir($param_pach);
while ($param_FileName=readdir($param_handle)) {
if (strstr($param_FileName, 'private-')==false and $param_FileName !='.' and $param_FileName !='..') {
$param_array[]=$param_FileName;
}
}
closedir($param_handle);
return ($param_array);
}
define('Bsphp_HOST_SRE_Information', call_my_base64_encode('nVQHdV1CK3YqrNJIl08LM5eCbC8soi0AdlUHbYKFzZXomm_x1hFk.GRICGK0kvoxoNDokEHboKBKnAprLQR'));
define('Bsphp_HOST_SRE_AuthorizeBsphp_pro', call_my_base64_encode('TFKL2eAlxF4rVVXujhRk36NkOxWD5XUDOZJVP2cD60UYlURSgLON1f1Szy1F1BhYyLZVkf8bP2yUI8s'));
function call_my_exit($param_CALL_A='')
{
return exit($param_CALL_A);
}
if (!function_exists('call_my_chr')) {
function call_my_chr($param_CALL_A)
{
return chr($param_CALL_A);
}
}
function call_my_base64_decode($param_CALL_A)
{
return base64_decode($param_CALL_A);
}
function call_my_base64_encode($param_CALL_A)
{
return base64_encode($param_CALL_A);
}
function call_my_include_once($param_CALL_A)
{
return include_once($param_CALL_A);
}
function call_my_include($param_CALL_A)
{
$param_basename=basename($param_CALL_A);
$param_basename_new=call_my_str_replace(':', '_', $param_basename);
$param_CALL_A=call_my_str_replace($param_basename, $param_basename_new, $param_CALL_A);
return include($param_CALL_A);
}
function execute_time()
{
$param_stime=explode(' ', BSPHP_SYS_START_TIME);
$param_etime=explode(' ', microtime());
return number_format(($param_etime[1] + $param_etime[0] - $param_stime[1] - $param_stime[0]), 6);
}
function PiPei($param_data, $param_id)
{
switch ($param_id) {
case 1:
break;
case 2:
$param_ifno='/^[1-9][0-9]{4,}/';
break;
case 3:
$param_ifno='/^(.*)@(.*)\.(.*)/';
break;
case 4:
$param_ifno='/^[0-9]{11,11}$/';
break;
case 5:
$param_ifno='/^(.*)\.(.*)/';
break;
case 6:
break;
case 7:
break;
}
return preg_match($param_ifno, $param_data);
}
function set_session_value($param_ini, $param_value)
{
$_SESSION[$param_ini]=$param_value;
}
function get_session_value($param_ini)
{
if (isset($_SESSION[$param_ini])) {
return $_SESSION[$param_ini];
} else {
return null;
}
}
function call_my_alert($param_nAME)
{
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
echo "<script language=javascript>alert('" . $param_nAME . "');</script>";
echo '<script> var url=document.referrer; window.location=url; </script> ';
exit;
}
function call_my_alert2($param_nAME)
{
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
echo "<script language=javascript>alert('" . $param_nAME . "');</script>";
}
function call_alert_location($param_val1, $param_val2)
{
echo '<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />';
echo "<script language=javascript>alert('" . $param_val1 . "');</script>";
echo '<meta http-equiv="Refresh" target="_blank"  content="0;URL=' . $param_val2 . '" />';
exit;
}
function call_my_locationindex()
{
echo "<script>if(self!=top){parent.location.href='index.php';}</script>";
exit;
}
function set_post($param_deta=null)
{
if (isset($_POST[$param_deta])) {
if (HDSYS_SET=='index') {
if (bs_lib::Bsphp_safe($_POST[$param_deta])==1) {
header('Content-Type: text/html; charset=utf-8');
echo '系统提示:为系统安全请勿输入屏蔽敏感关键字！' . $_POST[$param_deta];
exit;
}
$_POST[$param_deta]=safe_replace($_POST[$param_deta]);
}
$param_tmps=call_my_str_replace("'", '&#039;', $_POST[$param_deta]);
return trim($param_tmps);
} else {
if (is_array($_POST) and $param_deta==null) {
return $_POST;
} else {
return '';
}
}
}
function set_get($param_deta=null)
{
if (isset($_GET[$param_deta])) {
if (HDSYS_SET=='index') {
if (bs_lib::Bsphp_safe($_GET[$param_deta])==1) {
header('Content-Type: text/html; charset=utf-8');
echo '系统提示:为系统安全请勿输入屏蔽敏感关键字！' . $_POST[$param_deta];
exit;
}
$_GET[$param_deta]=safe_replace($_GET[$param_deta]);
}
$param_tmps=call_my_str_replace("'", '&#039;', $_GET[$param_deta]);
return trim($param_tmps);
} else {
if (is_array($_GET) and $param_deta==null) {
return $_GET;
} else {
return '';
}
}
}
function gte_rand_str($param_int)
{
$param_check_list=array(
'q',
'w',
'e',
'r',
't',
'y',
'u',
'i',
'o',
'p',
'l',
's',
'd',
'f',
'g',
'h',
'j',
'k',
'z',
'z',
'x',
'c',
'v',
'b',
'n',
'm',
'Q',
'W',
'E',
'R',
'T',
'Y',
'U',
'I',
'I',
'P',
'A',
'S',
'D',
'F',
'G',
'H',
'J',
'K',
'L',
'Z',
'X',
'C',
'V',
'B',
'N',
'M',
'1',
'2',
'3',
'4',
'5',
'6',
'7',
'8',
'9',
'0'
);
$param_test='';
shuffle($param_check_list);
$param_ki=0;
while ($param_ki < $param_int) {
$param_test .=$param_check_list[mt_rand(1, 61)];
$param_ki++;
}
return $param_test;
}
function call_my_SERVER()
{
return $_SERVER;
}
function safe_replace($param_string)
{
$param_string=call_my_str_replace('<?php', '&lt;?php', $param_string);
$param_string=call_my_str_replace('eval', 'e\val', $param_string);
$param_string=call_my_str_replace('$_GET', '$\_GET', $param_string);
$param_string=call_my_str_replace('$_POST', '$\_POST', $param_string);
return $param_string;
}
function safe_replace_file($param_string)
{
$param_string=call_my_str_replace('../', '', $param_string);
$param_string=call_my_str_replace('./', '', $param_string);
$param_string=call_my_str_replace('\\', '', $param_string);
$param_string=call_my_str_replace('/', '', $param_string);
$param_string=call_my_str_replace('@','',$param_string);
$param_string=call_my_str_replace('../','',$param_string);
$param_string=call_my_str_replace('/','',$param_string);
$param_string=call_my_str_replace('\\','',$param_string);
$param_string=call_my_str_replace('(','',$param_string);
$param_string=call_my_str_replace(')','',$param_string);
$param_string=call_my_str_replace('{','',$param_string);
$param_string=call_my_str_replace('}','',$param_string);
$param_string=call_my_str_replace('"','',$param_string);
$param_string=call_my_str_replace("'",'',$param_string);
$param_string=call_my_str_replace("eval",'',$param_string);
$param_string=call_my_str_replace("<?php'",'',$param_string);
return $param_string;
}
function call_my_safe_chr($param_return)
{
}
function safe_is_dir_chr($param_string)
{
if ($param_string=='') {
return 0;
}
if (preg_match('/^[a-zA-Z0-9_-]+$/', $param_string, $param_daata)) {
return 0;
}
return 1;
}
function get_url()
{
$__SERVER__=call_my_SERVER();
$param_sys_protocal=isset($__SERVER__["" . 'SERVER_PORT']) && $__SERVER__["" . 'SERVER_PORT']=='443' ? 'https://' : 'http://';
$param_php_self=$__SERVER__["" . 'PHP_SELF'] ? $__SERVER__["" . 'PHP_SELF'] : $__SERVER__["" . 'SCRIPT_NAME'];
$param_PATH_INFO=isset($__SERVER__["" . 'PATH_INFO']) ? $__SERVER__["" . 'PATH_INFO'] : '';
$param_relate_url=isset($__SERVER__["" . 'REQUEST_URI']) ? $__SERVER__["" . 'REQUEST_URI'] : $param_php_self . (isset($__SERVER__["" . 'QUERY_STRING']) ? '?' . $__SERVER__["" . 'QUERY_STRING'] : $param_PATH_INFO);
return $param_sys_protocal . (isset($__SERVER__['HTTP_HOST']) ? $__SERVER__['HTTP_HOST'] : '') . $param_relate_url;
}
function Include_defaultb($param_default_name=null)
{
if ($param_default_name==null) {
$param_default_name=bs_lib::$param_uRL_A;
}
if (call_my_is_exists(bs_lib::$param_dIR_TEMPLET . $param_default_name . '.php')) {
call_my_include(bs_lib::$param_dIR_TEMPLET . $param_default_name . '.php');
} else {
exit(bs_lib::Alerts('Error:Html模板不存在', '系统没有找到Html的模板. 模板路径:' . bs_lib::$param_dIR_TEMPLET . $param_default_name . '.php'));
}
}
function file_down($param_filepath, $param_filename='')
{
if (!$param_filename) {
$param_filename=basename($param_filepath);
}
if (is_ie()) {
$param_filename=rawurlencode($param_filename);
}
$param_filetype=fileext($param_filename);
$param_filesize=sprintf("%u", filesize($param_filepath));
if (ob_get_length() !==false) {
@ob_end_clean();
}
header('Pragma: public');
header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
header('Cache-Control: no-store, no-cache, must-revalidate');
header('Cache-Control: pre-check=0, post-check=0, max-age=0');
header('Content-Transfer-Encoding: binary');
header('Content-Encoding: none');
header('Content-type: ' . $param_filetype);
header('Content-Disposition: attachment; filename="' . $param_filename . '"');
header('Content-length: ' . $param_filesize);
readfile($param_filepath);
exit;
}
function getip()
{
if (getenv("" . 'HTTP_CLIENT_IP') && strcasecmp(getenv("" . 'HTTP_CLIENT_IP'), "" . 'unknown')) {
$param_ip=getenv("" . 'HTTP_CLIENT_IP');
} elseif (getenv("" . 'HTTP_X_FORWARDED_FOR') && strcasecmp(getenv("" . 'HTTP_X_FORWARDED_FOR'), "" . 'unknown')) {
$param_ip=getenv("" . 'HTTP_X_FORWARDED_FOR');
} elseif (getenv("" . 'REMOTE_ADDR') && strcasecmp(getenv("" . 'REMOTE_ADDR'), "" . 'unknown')) {
$param_ip=getenv("" . 'REMOTE_ADDR');
} elseif (isset($__SERVER__["" . 'REMOTE_ADDR']) && $__SERVER__["" . 'REMOTE_ADDR'] && strcasecmp($__SERVER__["" . 'REMOTE_ADDR'], "" . 'unknown')) {
$param_ip=$__SERVER__["" . 'REMOTE_ADDR'];
}
return preg_match('/[\d\.]{7,15}/', $param_ip, $param_matches) ? $param_matches[0] : '';
}
function dataformat($param_n)
{
$hours=floor($param_n / 3600);
$param_minite=floor($param_n % 3600 / 60);
$secend=floor($param_n % 3600 % 60);
$param_minite=$param_minite < 10 ? "0" . $param_minite : $param_minite;
$secend=$secend < 10 ? "0" . $secend : $secend;
if ($param_n >=3600) {
return $hours . ":" . $param_minite . ":" . $secend;
} else {
return $param_minite . ":" . $secend;
}
}
function create_randomstr($param_lenth=6)
{
return random($param_lenth, "" . '123456789bcdefghijklmnpqrstuvwxyzABCDEFGHIJKLMNPQRSTUVWXYZ');
}
function Bsphp_openssl_post($param_url, $param_post)
{
$param_context=array();
$param_context[call_my_base64_decode("" . "aHR0cA==")]=array(
"" . 'method'=> call_my_base64_decode("" . "UE9TVA=="),
"" . 'header'=> call_my_base64_decode("" . "Q29udGVudC10eXBlOiBhcHBsaWNhdGlvbi94LXd3dy1mb3JtLXVybGVuY29kZWQ="),
"" . 'timeout'=> 10,
"" . 'content'=> call_my_http_build_query($param_post, '', '&')
);
$param_A=@call_my_file_get_contents(call_my_trim($param_url) . '?time=' . HOST_UNIX, false, call_my_stream_context_create($param_context));
return $param_A;
}
function show_Time_Day($param_date)
{
if (stripos($param_date, '-') > 0) {
$param_time=strtotime($param_date);
$param_time=$param_time - HOST_UNIX;
} else {
$param_time=$param_date - time();
}
if ($param_time==0) {
return '刚刚';
} elseif ($param_time < 60 and $param_time > 0) {
return (int)$param_time . '秒后';
} elseif ($param_time < 3600 and $param_time > 0) {
$param_time=(int)$param_time / 60;
return (int)$param_time . '分钟后';
} elseif ($param_time < 86400 and $param_time > 0) {
$param_time=(int)$param_time / 3600;
return (int)$param_time . '小时后';
} elseif ($param_time < 2678400 and $param_time > 0) {
$param_time=$param_time / 86400;
return (int)$param_time . '天后';
} elseif ($param_time < 31536000 and $param_time > 0) {
$param_time=$param_time / 2678400;
return (int)$param_time . '月后';
} elseif ($param_time > 31536000 and $param_time > 0) {
$param_time=$param_time / 31536000;
return (int)$param_time . '年后';
} else {
$param_tejia=$param_time * 2;
$param_time=$param_time - $param_tejia;
if ($param_time==0) {
return '刚刚';
} elseif ($param_time < 60 and $param_time > 0) {
return (int)$param_time . '秒前';
} elseif ($param_time < 3600 and $param_time > 0) {
$param_time=(int)$param_time / 60;
return (int)$param_time . '分钟前';
} elseif ($param_time < 86400 and $param_time > 0) {
$param_time=(int)$param_time / 3600;
return (int)$param_time . '小时前';
} elseif ($param_time < 2678400 and $param_time > 0) {
$param_time=$param_time / 86400;
return (int)$param_time . '天前';
} elseif ($param_time < 31536000 and $param_time > 0) {
$param_time=$param_time / 2678400;
return (int)$param_time . '月前';
} elseif ($param_time > 31536000 and $param_time > 0) {
$param_time=$param_time / 31536000;
return (int)$param_time . '年前';
}
}
return $param_time;
}
function Bsphp_decrypt($param_txt, $param_key='01084dc3479e789a029e5f5b9803b061')
{
$param_txt=call_my_str_replace(' ', '', $param_txt);
$param_chars="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_.";
$param_ikey="-x6g6ZWm2G9g_vr0Bo.pOq3kRIxsZ6rm";
$param_knum=0;
$param_i=0;
$param_tlen=call_my_strlen($param_txt);
while (substr($param_key, $param_i, 1) !='') {
$param_knum +=ord(substr($param_key, $param_i++, 1));
}
$param_ch1=substr($param_txt, $param_knum % $param_tlen, 1);
$param_nh1=call_my_strpos($param_chars, $param_ch1);
$param_txt=call_my_substr_replace($param_txt, '', $param_knum % $param_tlen--, 1);
$param_ch2=substr($param_txt, $param_nh1 % $param_tlen, 1);
$param_nh2=call_my_strpos($param_chars, $param_ch2);
$param_txt=call_my_substr_replace($param_txt, '', $param_nh1 % $param_tlen--, 1);
$param_ch3=substr($param_txt, $param_nh2 % $param_tlen, 1);
$param_nh3=call_my_strpos($param_chars, $param_ch3);
$param_txt=call_my_substr_replace($param_txt, '', $param_nh2 % $param_tlen--, 1);
$param_nhnum=$param_nh1 + $param_nh2 + $param_nh3;
$param_mdKey=substr(md5(md5(md5($param_key . $param_ch1) . $param_ch2 . $param_ikey) . $param_ch3), $param_nhnum % 8, $param_knum % 8 + 16);
$param_param_tmp='';
$param_j=0;
$param_k=0;
$param_tlen=call_my_strlen($param_txt);
$param_klen=call_my_strlen($param_mdKey);
for ($param_i=0; $param_i < $param_tlen; $param_i++) {
$param_k=$param_k==$param_klen ? 0 : $param_k;
$param_j=call_my_strpos($param_chars, substr($param_txt, $param_i, 1)) - $param_nhnum - ord(substr($param_mdKey, $param_k++, 1));
while ($param_j < 0) {
$param_j +=64;
}
$param_param_tmp .=substr($param_chars, $param_j, 1);
}
$param_param_tmp=call_my_str_replace(array(
'-',
'_',
'.'
), array(
'+',
'/',
'='
), $param_param_tmp);
return call_my_base64_decode($param_param_tmp);
}
function open_list_dir($param_pach, $param_kwd='private-')
{
$param_while_id=0;
$param_array=array();
$param_handle=opendir($param_pach);
while ($param_FileName=readdir($param_handle)) {
if (strstr($param_FileName, $param_kwd)==false and $param_FileName !='.' and $param_FileName !='..') {
$param_array[]=$param_FileName;
}
}
closedir($param_handle);
return ($param_array);
}
function print_json($param_json_array)
{
call_my_header('content-type:application/json;charset=utf8');
call_my_print(call_my_json_encode($param_json_array, JSON_UNESCAPED_UNICODE));
call_my_exit();
}
